08. Inspecting Data Types

Inspecting Data Types

Use this Jupyter Notebook to inspect the datatypes of features in each dataset and think about what changes should be made to make them practical and consistent (in both datasets). Use this to help you answer the quiz questions below.

Workspace

This section contains either a workspace (it can be a Jupyter Notebook workspace or an online code editor work space, etc.) and it cannot be automatically downloaded to be generated here. Please access the classroom with your account and manually download the workspace to your local machine. Note that for some courses, Udacity upload the workspace files onto https://github.com/udacity , so you may be able to download them there.

Workspace Information:

  • Default file path:
  • Workspace type: jupyter
  • Opened files (when workspace is loaded): n/a

Which of the following changes could be made to make the cyl column in both datasets clear and consistent?

SOLUTION:
  • Extract int values from the strings in the 2008 cyl column.
  • Convert floats to ints in the 2018 cyl column.

Which of the following changes could be made to make the air_pollution_score column in both datasets consistent?

SOLUTION:
  • Convert strings to floats in the 2008 column.
  • Convert ints to floats in the 2018 columns.

Which of the following features need to be converted to floats from strings?

SOLUTION:
  • city_mpg (2008)
  • city_mpg (2018)
  • hwy_mpg (2008)
  • hwy_mpg (2018)
  • cmb_mpg (2008)
  • cmb_mpg (2018)

Which changes need to be made to make the greenhouse_gas_score columns in both datasets consistent?

SOLUTION:
  • Convert strings to ints in the 2008 column.